# Maintainer: Muflone http://www.muflone.com/contacts/english/
# Contributor: web.de jan.stuehler

pkgname=perl-pdf-builder
_perl_namespace=PDF
_perl_module=Builder
pkgver=3.025
pkgrel=1
pkgdesc="Facilitates the creation and modification of PDF files"
arch=('any')
url="https://metacpan.org/release/${_perl_namespace}-${_perl_module}"
license=('LGPL')
depends=('perl' 'perl-font-ttf')
checkdepends=('perl-test-exception' 'perl-test-memory-cycle')
source=("https://www.cpan.org/modules/by-module/${_perl_namespace}/${_perl_namespace}-${_perl_module}-${pkgver}.tar.gz")
sha256sums=('a9beb4efa0ec2975a9145cef052118b2098f46d9c1510dd65786a03d0da3e3d5')
options=('!emptydirs')

build() {
  cd "${_perl_namespace}-${_perl_module}-${pkgver}"
  unset PERL5LIB PERL_MM_OPT PERL_MB_OPT PERL_LOCAL_LIB_ROOT
  export PERL_MM_USE_DEFAULT=1 PERL_AUTOINSTALL=--skipdeps
  perl Makefile.PL
  make
}

check() {
  cd "${_perl_namespace}-${_perl_module}-${pkgver}"
  unset PERL5LIB PERL_MM_OPT PERL_MB_OPT PERL_LOCAL_LIB_ROOT
  export PERL_MM_USE_DEFAULT=1
  make test
}

package() {
  cd "${_perl_namespace}-${_perl_module}-${pkgver}"
  unset PERL5LIB PERL_MM_OPT PERL_MB_OPT PERL_LOCAL_LIB_ROOT
  make pure_install INSTALLDIRS=vendor DESTDIR="${pkgdir}"
  # Delete unuseful files
  find "${pkgdir}" -name '.packlist' -delete
}
